<!DOCTYPE html>
<html>
  <head>
    <title>字符串处理</title>
  </head>
  <body>
    <textarea id="inputText" rows="10" cols="50"></textarea>
    <br>
    <button onclick="processString1()">飞书格式</button>
    <button onclick="processString2()">CVS格式</button>
    <button onclick="processString3()">纷传格式</button>
    <br>
    <button onclick="processString12()">飞书转CVS</button>
    <button onclick="processString13()">飞书转纷传</button>
    <br>
    <textarea id="outputText" rows="10" cols="100"></textarea>

    <script>
      function processString1() {
        let inputStr = document.getElementById("inputText").value;
      
        // 使用正则表达式提取视频标题和链接
        let regex = /「(.*?)」[^]+?链接：(https:\/\/pan.quark.cn\/s\/\w+)/g;
        let matches;
        let processedStr = "";
      
        while ((matches = regex.exec(inputStr)) !== null) {
          let videoTitle = matches[1];
          let videoLink = matches[2];
      
          processedStr += videoTitle + "\n" + videoLink + "\n";
        }
      
        document.getElementById("outputText").value = processedStr;
      }
	  function processString2() {
	    let inputStr = document.getElementById("inputText").value;
	  
	    // 使用正则表达式提取视频标题和链接
	    let regex = /「(.*?)」[^]+?链接：(https:\/\/pan.quark.cn\/s\/\w+)/g;
	    let matches;
	    let processedStr = "";
	  
	    while ((matches = regex.exec(inputStr)) !== null) {
	      let videoTitle = matches[1];
	      let videoLink = matches[2];
	  
	      processedStr += videoTitle + "," + videoLink + "\n";
	    }
	  
	    document.getElementById("outputText").value = processedStr;
	  }
	  function processString3() {
	    let inputStr = document.getElementById("inputText").value;
	  
	    // 使用正则表达式提取视频标题和链接
	    let regex = /「(.*?)」[^]+?链接：(https:\/\/pan.quark.cn\/s\/\w+)/g;
	    let matches;
	    let processedStr = "";
	  
	    while ((matches = regex.exec(inputStr)) !== null) {
	      let videoTitle = matches[1];
	      let videoLink = matches[2];
	  
	      processedStr += videoTitle + "----" + videoLink + "\n";
	    }
	  
	    document.getElementById("outputText").value = processedStr;
	  }
	  function processString12() {
	    let inputStr = document.getElementById("inputText").value;
	  
	    // 使用正则表达式提取视频标题和链接
	    let regex = /(\d+)\.(.*?)\n(https:\/\/pan.quark.cn\/s\/\w+)/g;
	    let matches;
	    let processedStr = "";
	  
	    while ((matches = regex.exec(inputStr)) !== null) {
	      let episodeNumber = matches[1];
	      let videoTitle = matches[2];
	      let videoLink = matches[3];
	  
	      processedStr += episodeNumber + "." + videoTitle + "," + videoLink + "\n";
	    }
	  
	    document.getElementById("outputText").value = processedStr;
	  }
	  function processString13() {
	    let inputStr = document.getElementById("inputText").value;
	  
	    // 使用正则表达式提取视频标题和链接
	    let regex = /(\d+)\.(.*?)\n(https:\/\/pan.quark.cn\/s\/\w+)/g;
	    let matches;
	    let processedStr = "";
	  
	    while ((matches = regex.exec(inputStr)) !== null) {
	      let episodeNumber = matches[1];
	      let videoTitle = matches[2];
	      let videoLink = matches[3];
	  
	      processedStr += episodeNumber + "." + videoTitle + "----" + videoLink + "\n";
	    }
	  
	    document.getElementById("outputText").value = processedStr;
	  }
    </script>
  </body>
</html>
